home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9524 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: CONVERTING INTEGER TO ASCII??????
  5. Date: 11 Mar 1996 08:22:40 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4i1cvg$1cg@solutions.solon.com>
  8. References: <4i17r9$2kn@maltese.eag.unisysgsg.com>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4i17r9$2kn@maltese.eag.unisysgsg.com>,
  12. Daniel R. Ascheman <ssadra@maltese.eag.unisysgsg.com> wrote:
  13. >I need a way to convert an integer BACK to ascii so I can search for it 
  14. >in a file using the strstr() function in a file. I NEED it as an integer
  15. >AND as an ascii, is it possible?
  16.  
  17. If I said "no", would you believe me for an instant?  If not, why do
  18. you ask?
  19.  
  20. >As you know, strstr() is a char *, char * , so I can't use an int,
  21. >and itoa() does not exist in UNIX - I am in a slight bind.
  22.  
  23. An extremely slight bind.  Can anyone tell me why it is that dozens
  24. of people every year post this exact same question, and *none* of them
  25. hhave thought about sprintf?
  26.  
  27. >  return(2);
  28.  
  29. Agh!  Never use explicit values other than 0.
  30.  
  31. >If no conversion is possible in C/UNIX, anyone have any other ideas?
  32.  
  33. Look, it's trivial to write your own, and there's the printf family.  I
  34. just don't get it - how do people manage to miss both of these options?
  35.  
  36. >I would greatly appreciate comments and possible solutions.
  37.  
  38. Sure about that first one?  :)
  39.  
  40. -s
  41. -- 
  42. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  43. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  44. FUCK the communications decency act.  Goddamned government.  [literally.]
  45. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  46.